package cn.wen.yinxiu.member.controller;

import java.util.Arrays;
import java.util.Map;

import cn.wen.yinxiu.common.convention.result.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import cn.wen.yinxiu.member.entity.GroupEntity;
import cn.wen.yinxiu.member.service.GroupService;
import cn.wen.yinxiu.common.toolkit.PageUtils;
import cn.wen.yinxiu.common.convention.result.ResultEntity;



/**
 * 
 *
 * @ClassName: Group
 * @Author 小飞
 * @Email coderwen22@163.com
 * @Date 2023-05-21 22:19:26
 * @Description:
 */
@RestController
@RequestMapping("/web")
public class GroupController {

    @Autowired
    private GroupService groupService;


    /**
     * 退出群聊
     *
     * @param userId
     * @param groupId
     * @return
     */
    @PostMapping("/api/user/group/exit")
    public ResultEntity exitGroup(@RequestParam("userId") Long userId,
                                  @RequestParam("groupId") Long groupId) {
        boolean res = groupService.exitGroup(userId, groupId);
        if (!res) return Results.failure();
        return Results.success();
    }

}
